
package com.dy.run;

import java.io.IOException;
import java.sql.SQLException;

import com.dy.config.CreatConfig;
import com.dy.config.MysqlConfig;
import com.dy.model.ClassAndPackage;
import com.dy.model.TableInfo;
import com.dy.net.MysqlTableInfo;
import com.fasterxml.jackson.databind.ObjectMapper;

import lombok.Data;

/**
 * @Description:
 * @Date：2018年6月28日 @author： DongY
 * @version ：1.0 1.[2018年6月28日]CreatBy：dy
 */
@Data
public class Run {

	private MysqlConfig mysqlConfig;
	private CreatConfig config;

	public static void main(final String[] args)
			throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException, IOException {
		final MysqlConfig mysqlConfig = new MysqlConfig();
		mysqlConfig.setUrl("jdbc:mysql://192.168.0.118:3306/model_number_db?useUnicode=true&characterEncoding=utf-8");
		final CreatConfig config = new CreatConfig();
		config.setTableName("fi_mn_materials_data");
		final MysqlTableInfo mysqlTableInfo = new MysqlTableInfo();
		final TableInfo tableInfo = mysqlTableInfo.getTableInfos(mysqlConfig, config);
		System.out.println(new ObjectMapper().writeValueAsString(config));
		System.out.println(new ObjectMapper().writeValueAsString(mysqlConfig));
		// ------------------------------------------------------------------------------
		// 以上为获取表信息
		final ClassAndPackage classAndPackage = new ClassAndPackage(config, tableInfo);
		CreatManager.baseDir = System.getProperty("user.dir");
		final CreatManager manager = new CreatManager(tableInfo, classAndPackage);
		manager.ingnor("form");
		manager.ingnor("list");
		manager.docreat();
	}

	public void initConfig() {

	}
}
